<?php


namespace App\Model;


/**
 * App\Model\Refund
 *
 * @property int $id
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @property int $user_id 申请人
 * @property int|null $admin_id 操作人
 * @property int $order_goods_id
 * @property int $status 状态，1是申请中，2是退款中，3是已退款，4是已驳回
 * @property string $name 联系人
 * @property string $phone 电话
 * @property string $reason 退款原因
 * @property int $goods_id 商品表id
 * @property int $goods_sku_id 商品规格表
 * @property string $goods_name 商品名称
 * @property string $goods_sku_msg 商品规格信息
 * @property string $goods_img 商品图片
 * @property int $seller_id 商铺id
 * @property float $goods_price 商品单价
 * @property int $num 退款数量
 * @property float $refund_price 退款金额，可能与实际金额不符
 * @property float|null $real_refund_price 实际退款金额，从接口返回
 * @property int $pay_type 支付方式，1是微信支付，2是支付宝
 * @property int $order_transaction_id 交易表id
 * @property-read \App\Model\OrderTransaction $order_transaction
 * @property-read \App\Model\User $user
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Refund newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Refund newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Refund query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Refund whereAdminId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Refund whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Refund whereGoodsId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Refund whereGoodsImg($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Refund whereGoodsName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Refund whereGoodsPrice($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Refund whereGoodsSkuId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Refund whereGoodsSkuMsg($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Refund whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Refund whereName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Refund whereNum($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Refund whereOrderGoodsId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Refund whereOrderTransactionId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Refund wherePayType($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Refund wherePhone($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Refund whereRealRefundPrice($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Refund whereReason($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Refund whereRefundPrice($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Refund whereSellerId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Refund whereStatus($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Refund whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Refund whereUserId($value)
 * @mixin \Eloquent
 */
class Refund extends Base
{

    protected $table='refund';

    protected $fillable=['order_goods_id','status','name','phone','reason','user_id','admin_id','goods_id','goods_sku_id','goods_name','goods_sku_msg','goods_img','seller_id','goods_price','num','refund_price','real_refund_price','pay_type','order_transaction_id','order_id'];


    function user(){

        return $this->belongsTo(User::class,'user_id','id');
    }

    function order_transaction(){

        return $this->belongsTo(OrderTransaction::class,'order_transaction_id','id');
    }

    function order(){

        return $this->belongsTo(Order::class,'order_id','id');
    }

}
